home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 16 / index.fth < prev    next >
Text File  |  1985-11-19  |  1KB  |  53 lines

  1. \ Recreate the index file for the WHATIS database.  This is necessary
  2. \ if you modify the WHATIS.DOC file.
  3. \
  4. \ make-index  whatis.doc    Generate the new index
  5. \ write-index whatis.ind    Write it to disk
  6.  
  7. decimal
  8. only forth hidden also forth definitions
  9.  
  10. variable last-char
  11. : dropline  ( -- )
  12.    delimiter @ newline <>
  13.    if
  14.        pad newline ifd @ getcword  drop
  15.        delimiter off
  16.    then
  17. ;
  18. : set-index  ( position char -- )
  19.    dup  last-char @ <>  ( position char flag )
  20.    if  dup last-char !
  21.        32 - index swap na+ !
  22.    else 2drop
  23.    then
  24. ;
  25. : 1line  ( -- end? )
  26.    ifd @ ftell  ( pos )
  27.    pad  ifd @ getword ( pos str )
  28.    delimiter @ eof =
  29.    if    2drop true
  30.    else  1+ c@ set-index
  31.          dropline dropline
  32.          false
  33.    then
  34. ;
  35. : make-index  ( -- )  \ filename
  36.    reading
  37.    index /index th ff fill
  38.    last-char off
  39.    begin 1line  until
  40.    ifd @ close
  41. ;
  42. : write-index  ( -- )  \ filename
  43.    writing
  44.    index /index ofd @ fputs
  45.    ofd @ close
  46. ;
  47. only forth also definitions
  48. forth also definitions
  49. : label  \ name  ( -- )
  50.    create  !csp
  51.    assembler  [ assembler ] normal
  52. ;
  53. : interpre